package com.cjj.common.enums;

public enum OrderStatus {
    PENDING("pending"),
    REVIEWED("reviewed"),
    ACCEPTED("accepted"),
    COMPLETED("completed"),
    CANCELED("canceled"),
    REJECTED("rejected");

    private final String value;

    OrderStatus(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    /**
     * 根据字符串值获取枚举
     */
    public static OrderStatus fromValue(String value) {
        for (OrderStatus status : values()) {
            if (status.value.equals(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的订单状态: " + value);
    }
}